<template>
  <el-dialog
    v-model="dialogVisible"
    class="custom-dialog-prer"
    width="631px"
    @closed="handleDialogClose"
  >
    <div class="dialog-content">
      <div class="info">
        <div class="name">{{ currentChartData[0] }}</div>
      </div>
      <div class="dialog-content-item">
        <div class="item">
          <div v-if="currentChartData[1]">姓名：{{ currentChartData[1] }}</div>
          <div v-if="currentChartData[2]">
            手机号： {{ currentChartData[2] }}
          </div>
        </div>
      </div>
    </div>
  </el-dialog>
</template>

<script setup lang="ts">
import dayjs from 'dayjs'
import VChart from 'vue-echarts'
import apiList from '@/pages/conventional-fine-forecasting/api/api'
import { usePredictionStore } from '@/pages/conventional-fine-forecasting/store/store'
import { useBaseLeafletMapStore } from '@/store/modules/baseLeafletMap'
const permissions = localStorage.getItem('userInfo')
const predictionStore = usePredictionStore()
const baseLeafletMapStore = useBaseLeafletMapStore()

const isShow = computed(() => data => {
  return permissions.includes(data) || permissions.includes('*:*:*')
})
const dialogVisible = ref(false)
const chartRef = ref('')
const dialogTitle = ref('')
const pos = ref({
  lon: '',
  lat: ''
})
const currentData = ref({})
const tableData = ref([])
const predictionDayData = ref([])
const leftData = ref([])
const defaultData = () => ({
  tem: '',
  RAIN: '',
  visHor10mi: '',
  rhu: '',
  winSAvg10mi: '',
  prs: ''
})

const currentStationData = ref(defaultData())

const currentChartData = ref([])
const handleBureauDialogVisible = (visible, data) => {
  dialogVisible.value = visible
  if (data) {
    currentChartData.value = data.split(',')
  }
}

useEventBus('handleBureauDialogVisible').on(handleBureauDialogVisible)
const handleDialogClose = () => {
  dialogTitle.value = ''
  currentData.value = {}
  currentStationData.value = defaultData()
  currentChartData.value = []
}
</script>

<style scoped lang="scss">
.dialog-content {
  width: 100%;
  box-sizing: border-box;

  .info {
    width: 100%;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    padding: 0 39px 0 21px;
    .name {
      font-weight: bold;
      font-size: 20px;
      color: #ffffff;
      line-height: 55px;
      text-shadow: 0px 0px 10px #000c5f;
      text-align: center;
      font-style: normal;
      text-transform: none;
    }
    .title {
      font-weight: bold;
      font-size: 20px;
      color: #ffffff;
      line-height: 0px;
      text-shadow: 0px 0px 10px #000c5f;
      text-align: center;
      font-style: normal;
    }

    .time {
      font-weight: 400;
      font-size: 16px;
      color: #dde7ee;
      line-height: 0px;
      text-align: center;
      font-style: normal;
    }
  }
  .dialog-content-item {
    height: auto;
    margin-top: 15px;
    padding: 20px 21px;
    box-sizing: border-box;
    .item {
      width: 631px;
      height: 42px;
      display: flex;
      justify-content: space-around;

      div {
        width: 200px;
        height: 42px;
        background: url('../images/contentData.png') no-repeat;
        background-size: 100% 100%;
        line-height: 42px;
        padding-left: 10px;
        box-sizing: border-box;
        color: #fff;
      }
    }
  }
}
/* 修改滚动条的样式 */
::-webkit-scrollbar {
  width: 1px; /* 设置滚动条的宽度 */
}
/* 滚动条滑块样式 */
::-webkit-scrollbar-thumb {
  border-radius: 10px;
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-track {
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.1);
}
</style>
<style lang="scss">
.el-overlay {
  z-index: 100000 !important;
}

.custom-dialog-prer {
  background-color: transparent;
  min-height: 156px;
  background: url(../images/dialognew.png) no-repeat;
  background-size: 100% 300%;
}
.el-overlay-dialog {
  position: fixed;
  top: 0px;
  right: 0;
  bottom: 0;
  // left: -1024px;
  overflow: auto;
}
</style>
